import java.util.ArrayList;
import java.util.List;

/**
 * @modulename IntermediateFile
 * @description The IntermediateFile Object is used to build and format the
 * Intermediate File used in the Second Pass of the Assembler
 * @callsequence 
 * <code>IntermedaiteFile testIFile = new IntermediateFile(File savelocation)</code>
 * @inparam savelocation a File that stores final Intermediate File. If there is 
 * already a file present in the location of the incoming file, it will be overwritten.
 * @outparam none
 * @errorstested 
 * @errorsgenerated 
 * @author Travis Casper
 * @createdate 10/14/09
 * @modlog <p>
 *         <ul>
 *         Who/When/Why
 *         <li>Travis 10/15/09 Still Unfinished. Started Formatting and taking Inputs
 *         <li>Travis 10/17/09 Fixed Bug that would not allow file input. 
 *         Learned how to input a file on a Mac
 *         <li>Travis 10/18/09 Updated and Changed AddOperand
 *         </ul>
 *         Coding Standards Met: "Signed Code Leader(Jaron)"
 *         <p>
 *         Testing Standards Met: "Signed Test Leader(Jamie)"
 */
public class IntermediateFile {
	protected static List<String> sourceCodeArray;
	protected static List<Integer> locationCounterArray;
	protected static List<String> labelArray;
	protected static List<String> operationArray;
	protected static List<String> binaryOperationArray;
	protected static List<List<String>> operandsArray;
	protected static List<Integer> irArray;
	protected static List<Integer> arArray;
	protected static List<Integer> brArray;
	protected static List<Integer> debugArray;
	protected static List<Integer> relativeAddress;
	protected static List<Integer> indirectAddress;
	protected static List<Integer> directAddress;
	protected static List<String> fullOperandArray;
	protected static List<String> relocationCodeArray;
	protected static List<String> literalArray;
	protected static List<Integer> literalLineNumbersArray;
	protected static List<String> tempOperandsArray;

	protected static List<String> finishedLines;
	protected static List<List<String>> allLinesInfo;
	protected static List<String> lineInfo;

	protected static Boolean isEmptyLine;
	protected static int totalLC;
	protected static Boolean debugIsOn;
	protected static String newline = System.getProperty("line.separator");
	private static int previousLC;
	private static int size;


	/**
	 * @modulename IntermediateFile Constructor
	 * @description The Constructor for the IntermediateFile will add the base source code
	 * to the IntermediateFile Representation. Use the other methods to add the 
	 * various information to the IntermediateFile Object.
	 * @callsequence 
	 * 
	 * @inparam saveLocation the File where the Intermediate Output will be saved. If there
	 * is already a file present, it will be deleted.
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>Travis 10/15/09 Fixed Bug in Formatting
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void startIntermediateFile() {
		IntermediateFile.sourceCodeArray = new ArrayList<String>(0);
		IntermediateFile.locationCounterArray = new ArrayList<Integer>(0);
		IntermediateFile.labelArray = new ArrayList<String>(0);
		IntermediateFile.operationArray = new ArrayList<String>(0);
		IntermediateFile.binaryOperationArray = new ArrayList<String>(0);
		IntermediateFile.operandsArray = new ArrayList<List<String>>(0);
		IntermediateFile.irArray = new ArrayList<Integer>(0);
		IntermediateFile.arArray = new ArrayList<Integer>(0);
		IntermediateFile.brArray = new ArrayList<Integer>(0);
		IntermediateFile.debugArray = new ArrayList<Integer>(0);
		IntermediateFile.relativeAddress = new ArrayList<Integer>(0);
		IntermediateFile.indirectAddress = new ArrayList<Integer>(0);
		IntermediateFile.directAddress = new ArrayList<Integer>(0);
		IntermediateFile.tempOperandsArray = new ArrayList<String>(0);
		IntermediateFile.finishedLines = new ArrayList<String>(0);
		IntermediateFile.lineInfo = new ArrayList<String>(0);
		IntermediateFile.allLinesInfo = new ArrayList< List<String>>(0);
		IntermediateFile.isEmptyLine = new Boolean(false);
		IntermediateFile.debugIsOn = new Boolean(false);
		IntermediateFile.fullOperandArray = new ArrayList<String>(0);
		IntermediateFile.relocationCodeArray = new ArrayList<String>(0);
		IntermediateFile.literalArray = new ArrayList<String>(0);
		IntermediateFile.literalLineNumbersArray = new ArrayList<Integer>(0);
		IntermediateFile.operandsArray.add(IntermediateFile.tempOperandsArray);
		IntermediateFile.allLinesInfo.add(IntermediateFile.lineInfo);
		IntermediateFile.previousLC = 0;
		IntermediateFile.size = 0;
	}

	/**
	 * @modulename addLocationCounter
	 * @description This Method adds the Location Counter Value of the 
	 * current line of Source Code to that line's information in the 
	 * IntermediateFile Object. This Method is required to be run, as each line 
	 * of Source Code must have a Location Counter value. However, this method 
	 * cannot be run more than one time, as there will never be a case where 
	 * there will be more than one Location Counter Value for a given line of 
	 * source code. REQUIRED, CALL ONCE. 
	 * @callsequence Once an Intermediate File is created, use this method to 
	 * 
	 * @inparam lc An Integer that represents the correct Location Counter for the current
	 * line of code.
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addLocationCounter(Integer lc) {
		IntermediateFile.locationCounterArray.add(lc);
		IntermediateFile.previousLC = lc;
		IntermediateFile.lineInfo.add("lcSet");
	}

	/**
	 * @modulename addLabel
	 * @description Adds the Label of the current line of source code 
	 * to the IntermediateFile Object. Not every line of Source Code will have 
	 * a label, so this method is not required for every line of code. However, 
	 * for each line of code, this method may only be run once, as there will 
	 * never be a case where there will be more than one label for a given line 
	 * of source code. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam label A String that Represents the Label for the current line.
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addLabel(String label) {
		IntermediateFile.labelArray.add(label);
		IntermediateFile.lineInfo.add("labelSet");
	}

	/**
	 * @modulename addOperation
	 * @description This Method adds the Operation of the current line 
	 * of Source Code to that line's information in the IntermediateFile 
	 * Object. This Method is required to be run, as each line of Source Code 
	 * must have an Operation. However, this method cannot be run more than one 
	 * time, as there will never be a case where there will be more than one 
	 * Operation for a given line of source code. REQUIRED, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam operation A String that represents the Directive or Machine 
	 * Instruction for the current line of code.
	 * 
	 * @outparam none
	 * 
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addOperation(String operation) {
		IntermediateFile.operationArray.add(operation.toUpperCase());	
		IntermediateFile.lineInfo.add("opSet");
	}
	

	/**
	 * @modulename addBinaryOperation
	 * @description This Method adds the Binary Value of the current 
	 * line of Source Code's Operation to that line's information in the 
	 * IntermediateFile Object. This Method is required to be run, as each line 
	 * of Source Code must have a Binary Value for its Operation. However, this 
	 * method cannot be run more than one time, as there will never be a case 
	 * where there will be more than one Operation for a given line of source 
	 * code, and thus only one Binary Value for the Operation. REQUIRED, CALL ONCE.
	 * @callsequence 
	 * 
	 * @inparam binOp a String that Represents the Binary Value of the Current Operations
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addBinaryOperation(String binOp) {
		IntermediateFile.binaryOperationArray.add(binOp);
		IntermediateFile.lineInfo.add("binOpSet");
	}

	/**
	 * @modulename addOperand
	 * @description Adds an Operand of the current line of source code 
	 * to the IntermediateFile Object. Not every line of Source Code will have 
	 * an Operand, so this method is not required for every line of code. Also, 
	 * for each line of code, this method may be run as many times as there are
	 * operands in the current line of code. OPTIONAL, MULTIPLE CALLS POSSIBLE.
	 * @callsequence 
	 * 
	 * @inparam op String that represents an Operand of the Current Line
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addAnOperand(String op) {
		IntermediateFile.tempOperandsArray.add(op);
		IntermediateFile.lineInfo.add("operandSet");
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void addFullOperand(String operand) {
		IntermediateFile.fullOperandArray.add(operand);
		IntermediateFile.lineInfo.add("fullOpSet");
	}

	/**
	 * @modulename addLocationCounter
	 * @description This Method adds the Location Counter Value of the 
	 * current line of Source Code to that line's information in the 
	 * IntermediateFile Object. This Method is required to be run, as each line 
	 * of Source Code must have a Location Counter value. However, this method 
	 * cannot be run more than one time, as there will never be a case where 
	 * there will be more than one Location Counter Value for a given line of 
	 * source code. REQUIRED, CALL ONCE. 
	 * @callsequence Once an Intermediate File is created, use this method to 
	 * 
	 * @inparam lc An Integer that represents the correct Location Counter for the current
	 * line of code.
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addLocationCounter(Integer lineNumber, Integer lc) {
		if (lineNumber >= locationCounterArray.size()) {
			IntermediateFile.locationCounterArray.add(lc);
		} else {
			IntermediateFile.locationCounterArray.add(lineNumber, lc);
		}
		IntermediateFile.previousLC = lc;
		IntermediateFile.lineInfo.add("lcSet");
	}

	/**
	 * @modulename addLabel
	 * @description Adds the Label of the current line of source code 
	 * to the IntermediateFile Object. Not every line of Source Code will have 
	 * a label, so this method is not required for every line of code. However, 
	 * for each line of code, this method may only be run once, as there will 
	 * never be a case where there will be more than one label for a given line 
	 * of source code. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam label A String that Represents the Label for the current line.
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addLabel(Integer lineNumber, String label) {
		if (lineNumber >= labelArray.size()) {
			IntermediateFile.labelArray.add(label);
		} else { 
			IntermediateFile.labelArray.add(lineNumber, label);
		}
		IntermediateFile.lineInfo.add("labelSet");

	}	

	/**
	 * @modulename addOperation
	 * @description This Method adds the Operation of the current line 
	 * of Source Code to that line's information in the IntermediateFile 
	 * Object. This Method is required to be run, as each line of Source Code 
	 * must have an Operation. However, this method cannot be run more than one 
	 * time, as there will never be a case where there will be more than one 
	 * Operation for a given line of source code. REQUIRED, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam operation A String that represents the Directive or Machine 
	 * Instruction for the current line of code.
	 * 
	 * @outparam none
	 * 
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addOperation(Integer lineNumber, String operation) {
		if (lineNumber >= operationArray.size()) {
			IntermediateFile.operationArray.add(operation.toUpperCase());
		} else {
			IntermediateFile.operationArray.add(lineNumber, operation.toUpperCase());
		}
		IntermediateFile.lineInfo.add("opSet");
	}
	
	public static void setOperation(Integer lineNumber, String operation) {
		if (lineNumber >= operationArray.size()) {
			IntermediateFile.operationArray.add(operation.toUpperCase());
		} else {
			IntermediateFile.operationArray.set(lineNumber, operation.toUpperCase());
		}
		IntermediateFile.lineInfo.add("opSet");
	}

	/**
	 * @modulename addBinaryOperation
	 * @description This Method adds the Binary Value of the current 
	 * line of Source Code's Operation to that line's information in the 
	 * IntermediateFile Object. This Method is required to be run, as each line 
	 * of Source Code must have a Binary Value for its Operation. However, this 
	 * method cannot be run more than one time, as there will never be a case 
	 * where there will be more than one Operation for a given line of source 
	 * code, and thus only one Binary Value for the Operation. REQUIRED, CALL ONCE.
	 * @callsequence 
	 * 
	 * @inparam binOp a String that Represents the Binary Value of the Current Operations
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addBinaryOperation(Integer lineNumber, String binOp) {
		if (lineNumber >= binaryOperationArray.size()) {
			IntermediateFile.addBinaryOperation(binOp);
		} else {
			IntermediateFile.binaryOperationArray.add(lineNumber, binOp);
		}
		IntermediateFile.lineInfo.add("binOpSet");
	}
	
	public static void setBinaryOperation(Integer lineNumber, String binOp) {
		if (lineNumber >= binaryOperationArray.size()) {
			IntermediateFile.addBinaryOperation(binOp);
		} else {
			IntermediateFile.binaryOperationArray.set(lineNumber, binOp);
		}
		IntermediateFile.lineInfo.add("binOpSet");
	}

	/**
	 * @modulename addOperand
	 * @description Adds an Operand of the current line of source code 
	 * to the IntermediateFile Object. Not every line of Source Code will have 
	 * an Operand, so this method is not required for every line of code. Also, 
	 * for each line of code, this method may be run as many times as there are
	 * operands in the current line of code. OPTIONAL, MULTIPLE CALLS POSSIBLE.
	 * @callsequence 
	 * 
	 * @inparam op String that represents an Operand of the Current Line
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addAnOperand(Integer lineNumber, String op) {
		IntermediateFile.tempOperandsArray.add(op);
		IntermediateFile.lineInfo.add("operandSet");
	}
	
	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void addFullOperand(Integer lineNumber, String operand) {
		if (lineNumber >= fullOperandArray.size()) {
			IntermediateFile.addFullOperand(operand);
		} else {
			IntermediateFile.fullOperandArray.add(lineNumber, operand);
		}
		IntermediateFile.lineInfo.add("fullOpSet");
	}
	
	public static void setFullOperand(Integer lineNumber, String operand) {
		if (lineNumber >= fullOperandArray.size()) {
			IntermediateFile.addFullOperand(operand);
		} else {
			IntermediateFile.fullOperandArray.set(lineNumber, operand);
		}
		IntermediateFile.lineInfo.add("fullOpSet");
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void addRelocationCode(String relocationCode) {
		IntermediateFile.relocationCodeArray.add(relocationCode);
		IntermediateFile.lineInfo.add("relCodeSet");
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void addLiteral(String literal) {
		IntermediateFile.literalArray.add(literal);
		IntermediateFile.literalLineNumbersArray.add(PassOne.lineNumber);
	}

	/**
	 * @modulename addEmptyLine
	 * @description When an Empty Line is encountered, use this method to 
	 * correctly set the formatting of the current Empty Line of Source Code in 
	 * the final Intermediate File Output. Not every line of Source Code will 
	 * be empty, so this method is not required for every line of code. Also, 
	 * each line of Source Code this method can only be called once, as a line 
	 * of Source Code can either be empty or not. OPTIONAL, CALL ONCE.
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addEmptyLine() {
		IntermediateFile.isEmptyLine = Boolean.TRUE;
	}

	/**
	 * @modulename addNOP
	 * @description When an Intermediate Error or NOP is encountered, use this 
	 * method to correctly convert a NOP into a SLC-AC 0 in the final 
	 * Intermediate File Output. Not every line of Source Code will be a NOP, so
	 * this method is not required for every line of code. Also, each line of 
	 * Source Code this method can only be called once, as a line of Source Code
	 * can either be empty or not. OPTIONAL, CALL ONCE.
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addNOP() {
		IntermediateFile.setOperation(PassOne.lineNumber, "SLA-AC");
		IntermediateFile.setFullOperand(PassOne.lineNumber, "0");
		IntermediateFile.addAnOperand(PassOne.lineNumber, "0");
		IntermediateFile.setBinaryOperation(PassOne.lineNumber, "011100");
	}
	
	public static void addNOP(int locationCounter) {
		IntermediateFile.addOperation(PassOne.lineNumber, "SLA-AC");
		IntermediateFile.addFullOperand(PassOne.lineNumber, "0");
		IntermediateFile.addAnOperand(PassOne.lineNumber, "0");
		IntermediateFile.addBinaryOperation(PassOne.lineNumber, "011100");
		IntermediateFile.addLocationCounter(PassOne.lineNumber, locationCounter);
	}

	/**
	 * @modulename turnOnIR
	 * @description Turns ON the Index Register Flag for the current line of 
	 * Source Code in the IntermediateFile Object. Not every line of Source Code 
	 * will use the Index Register, so this method is not required for every 
	 * line of code. However, there is no <code>turnOffIR()</code> method, 
	 * therefore, the Index Register Flag is turned OFF by default, and MUST be 
	 * turned ON for each line of Source Code that uses the Index Register. 
	 * This method may only be called once, as the Index Register Flag cannot be 
	 * turned ON after it is already ON. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void turnOnIR() {
		IntermediateFile.irArray.add(1);
		if (!IntermediateFile.lineInfo.contains("IRSet")) {
			IntermediateFile.lineInfo.add("IRSet");
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void turnOnIR(int lineNumber) {
		IntermediateFile.irArray.set(lineNumber, 1);
		if (!IntermediateFile.lineInfo.contains("IRSet")) {
			IntermediateFile.lineInfo.add("IRSet");
		}
	}

	/**
	 * @modulename turnOnAR
	 * @description Turns ON the Alternative Register Flag for the current line of 
	 * Source Code in the IntermediateFile Object. Not every line of Source Code 
	 * will use the Alternative Register, so this method is not required for every 
	 * line of code. However, there is no <code>turnOffAR()</code> method, 
	 * therefore, the Alternative Register Flag is turned OFF by default, and MUST be 
	 * turned ON for each line of Source Code that uses the Alternative Register. 
	 * This method may only be called once, as the Alternative Register Flag cannot be 
	 * turned ON after it is already ON. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void turnOnAR() {
		IntermediateFile.arArray.add(1);
		if (!IntermediateFile.lineInfo.contains("ARSet")) {
			IntermediateFile.lineInfo.add("ARSet");
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void turnOnAR(int lineNumber) {
		IntermediateFile.arArray.set(lineNumber, 1);
		if (!IntermediateFile.lineInfo.contains("ARSet")) {
			IntermediateFile.lineInfo.set(lineNumber,"ARSet");
		}
	}

	/**
	 * @modulename turnOnBR
	 * @description Turns ON the Base Register Flag for the current line of 
	 * Source Code in the IntermediateFile Object. Not every line of Source Code 
	 * will use the Base Register, so this method is not required for every 
	 * line of code. However, there is no <code>turnOffBR()</code> method, 
	 * therefore, the Base Register Flag is turned OFF by default, and MUST be 
	 * turned ON for each line of Source Code that uses the Base Register. 
	 * This method may only be called once, as the Base Register Flag cannot be 
	 * turned ON after it is already ON. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void turnOnBR() {
		IntermediateFile.brArray.add(1);
		if (!IntermediateFile.lineInfo.contains("BRSet")) {
			IntermediateFile.lineInfo.add("BRSet");
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void turnOnBR(int lineNumber) {
		IntermediateFile.brArray.set(lineNumber,1);
		if (!IntermediateFile.lineInfo.contains("BRSet")) {
			IntermediateFile.lineInfo.set(lineNumber,"BRSet");
		}
	}

	/**
	 * @modulename turnOnDebug
	 * @description Turns OFF the Debug Flag for the current line of 
	 * Source Code in the IntermediateFile Object. Not every line of Source Code 
	 * will use the Debug Flag, so this method is not required for every 
	 * line of code. The Debug Flag is turned OFF by default, and MUST be 
	 * turned ON for each line of Source Code that uses the Debug. 
	 * This method may only be called once, as the Debug Flag cannot be 
	 * turned ON after it is already ON. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void turnOnDebug() {
		IntermediateFile.debugIsOn = Boolean.TRUE;
		IntermediateFile.debugArray.add(1);
		if (!IntermediateFile.lineInfo.contains("DebugSet")) {
			IntermediateFile.lineInfo.add("DebugSet");
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void turnOnDebug(int lineNumber) {
		IntermediateFile.debugIsOn = Boolean.TRUE;
		IntermediateFile.debugArray.set(lineNumber, 1);
		if (!IntermediateFile.lineInfo.contains("DebugSet")) {
			IntermediateFile.lineInfo.set(lineNumber, "DebugSet");
		}
	}

	/**
	 * @modulename turnOffDebug
	 * @description Turns OFF the Debug Flag for the current line of 
	 * Source Code in the IntermediateFile Object. Not every line of Source Code 
	 * will use the Debug Flag, so this method is not required for every 
	 * line of code. The Debug Flag is turned OFF by default, and therefore it 
	 * does not need to be explicitly turned OFF for each line of Source Code.
	 * This method may only be called once, as the Debug Flag cannot be 
	 * turned OFF after it is already OFF. OPTIONAL, CALL ONCE. 
	 * @see #turnOnDebug()
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void turnOffDebug() {
		System.out.println("TURN OFF DEBUG");
		IntermediateFile.debugIsOn = Boolean.FALSE;
		IntermediateFile.debugArray.add(0);
		if (!IntermediateFile.lineInfo.contains("DebugSet")) {
			IntermediateFile.lineInfo.add("DebugSet");
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void turnOffDebug(int lineNumber) {
		System.out.println("TURN OFF DEBUG");
		IntermediateFile.debugIsOn = Boolean.FALSE;
		IntermediateFile.debugArray.add(0);
		if (!IntermediateFile.lineInfo.contains("DebugSet")) {
			IntermediateFile.lineInfo.add("DebugSet");
		}
	}

	/**
	 * @modulename turnOnRelativeAddressing
	 * @description Turns ON the Relative Addressing for the current line of 
	 * Source Code in IntermediateFile Object. Not every line of Source Code 
	 * will use Relative Addressing, so this method is not required for every 
	 * line of code. However, there is no <code>turnOffRelativeAddressing()</code> method, 
	 * therefore, Relative Addressing is turned OFF by default, and MUST be 
	 * turned ON for each line of Source Code that uses Relative Addressing. 
	 * This method may only be called once, as Relative Addressing cannot be 
	 * turned ON after it is already ON. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void turnOnRelativeAddressing() {
		IntermediateFile.relativeAddress.add(1);
		if (!IntermediateFile.lineInfo.contains("RelativeAddSet")) {
			IntermediateFile.lineInfo.add("RelativeAddSet");
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void turnOnRelativeAddressing(int lineNumber) {
		if (lineNumber >= IntermediateFile.relativeAddress.size()) {
			IntermediateFile.turnOnRelativeAddressing();
		} else {
			IntermediateFile.relativeAddress.set(lineNumber,1);
		}
		if (!IntermediateFile.lineInfo.contains("RelativeAddSet")) {
			IntermediateFile.lineInfo.add("RelativeAddSet");
		}
	}


	/**
	 * @modulename turnOnIndirectAddressing
	 * @description Turns ON Indirect Addressing for the current line of 
	 * Source Code in the IntermediateFile Object. Not every line of Source Code 
	 * will use Indirect Addressing, so this method is not required for every 
	 * line of code. However, there is no <code>turnOffIndirectAddressing()</code> method, 
	 * therefore, Indirect Addressing is turned OFF by default, and MUST be 
	 * turned ON for each line of Source Code that uses Indirect Addressing. 
	 * This method may only be called once, as Indirect Addressing cannot be 
	 * turned ON after it is already ON. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void turnOnIndirectAddressing() {
		IntermediateFile.indirectAddress.add(1);
		if (!IntermediateFile.lineInfo.contains("IndirectAddSet")) {
			IntermediateFile.lineInfo.add("IndirectAddSet");
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void turnOnIndirectAddressing(int lineNumber) {
		IntermediateFile.indirectAddress.set(lineNumber,1);
		if (!IntermediateFile.lineInfo.contains("IndirectAddSet")) {
			IntermediateFile.lineInfo.add("IndirectAddSet");
		}
	}

	/**
	 * @modulename turnOnDirectAddressing
	 * @description Turns ON Direct Addressing for the current line of 
	 * Source Code in the IntermediateFile Object. Not every line of Source Code 
	 * will use Direct Addressing, so this method is not required for every 
	 * line of code. However, there is no <code>turnOffDirectAddressing()</code> method, 
	 * therefore, Direct Addressing is turned OFF by default, and MUST be 
	 * turned ON for each line of Source Code that uses Direct Addressing. 
	 * This method may only be called once, as Direct Addressing cannot be 
	 * turned ON after it is already ON. OPTIONAL, CALL ONCE. 
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void turnOnDirectAddressing() {
		IntermediateFile.directAddress.add(1);
		IntermediateFile.addRelocationCode("A");
		if (!IntermediateFile.lineInfo.contains("DirectAddSet")) {
			IntermediateFile.lineInfo.add("DirectAddSet");
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void turnOnDirectAddressing(int lineNumber) {
		IntermediateFile.directAddress.add(1);
		IntermediateFile.addRelocationCode("A");
		if (!IntermediateFile.lineInfo.contains("DirectAddSet")) {
			IntermediateFile.lineInfo.add("DirectAddSet");
		}
	}

	/**
	 * @modulename editRelocationCode
	 * @description Sets the Relocation Code for the line of code with the 
	 * given line number to the given Relocation Code.
	 * @callsequence <code>IntermediateFile.editRelocationCode(11, "C");</code>
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Relocation Code will be edited.
	 * <p>
	 * relocationCode - A String that represents the new Relocation Code that 
	 * this line should use.
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void editRelocationCode(Integer lineNumber, String relocationCode) {
		IntermediateFile.relocationCodeArray.set(lineNumber, relocationCode);
	}

	/**
	 * @modulename editLocationCounter
	 * @description Sets the Location Counter for the line of code with the 
	 * given line number to the given Location Counter.
	 * @callsequence <code>IntermediateFile.editLocationCounter(11, 5);</code>
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Location Counter will be edited.
	 * <p>
	 * LocationCounter - A String that represents the new Location Counter that 
	 * this line should use.
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */	
	public static void editLocationCounter(Integer lineNumber, Integer locationCounter) {
		IntermediateFile.locationCounterArray.set(lineNumber, locationCounter);
	}

	/**
	 * @modulename changeLineToNOP
	 * @description When an Intermediate Error is encountered, use this method 
	 * to correctly convert the line into a SLC-AC 0 in the final Intermediate 
	 * File Output. Not every line of Source Code will be a NOP, so this method 
	 * is not required for every line of code. Also, each line of Source Code 
	 * this method can only be called once, as a line of Source Code can either 
	 * be empty or not. OPTIONAL, CALL ONCE.
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 
	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void changeLineToNOP(Integer lineNumber) {
		//lineNumber = lineNumber - 1;
		IntermediateFile.setOperation(lineNumber, "SLA-AC");
		IntermediateFile.setFullOperand(lineNumber, "0");
		IntermediateFile.setBinaryOperation(lineNumber, "011100");
		IntermediateFile.turnOnDirectAddressing(lineNumber);
	}
		

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static boolean lineUsedLiteral(int lineNumber) {
		return literalLineNumbersArray.contains(lineNumber);
	}

	/**
	 * @modulename returnLocationCounter
	 * @description Returns the Location Counter for the line of code with the 
	 * given line number as a String that is a decimal representation of the 
	 * line of code's Location Counter.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Location Counter will be returned.
	 * 
	 * @outparam An Integer that is a decimal representation of the line of
	 * code's Location Counter.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static Integer returnLocationCounter(int lineNumber) {
		return locationCounterArray.get(lineNumber);
	}

	/**
	 * @modulename returnLabel
	 * @description Returns the Label for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Label will be returned.
	 * 
	 * @outparam A String that is the Label for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnLabel(int lineNumber) {
		return labelArray.get(lineNumber);
	}

	/**
	 * @modulename returnOperation
	 * @description Returns the Operation for the line of code with the 
	 * given line number as a String that is a hex representation of the line of
	 * code's Operation.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Operation will be returned.
	 * 
	 * @outparam A String that is the Operation for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnOperation(int lineNumber) {
		return operationArray.get(lineNumber);
	}

	/**
	 * @modulename returnBinaryOperation
	 * @description Returns the Binary Operation for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Binary Operation will be returned.
	 * 
	 * @outparam A String that is the Binary Operation for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnBinaryOperation(int lineNumber) {
		return binaryOperationArray.get(lineNumber);
	}

	/**
	 * @modulename returnFullOperand
	 * @description Returns the Full Operand for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Full Operand will be returned.
	 * 
	 * @outparam A String that is the Full Operand for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnFullOperand(int lineNumber) {
		return fullOperandArray.get(lineNumber);
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static List<String> returnOperands(int lineNumber) {
		return operandsArray.get(lineNumber);
	}

	/**
	 * @modulename returnRelocationCode
	 * @description Returns the Relocation Code for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Relocation Code will be returned.
	 * 
	 * @outparam A String that is the Relocation Code for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnRelocationCode(int lineNumber) {
		return relocationCodeArray.get(lineNumber);
	}

	/**
	 * @modulename returnAddressFlags
	 * @description Returns the Address Flags for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Address Flags will be returned.
	 * 
	 * @outparam A String that is the 3-digit Address Flag Value for the Current 
	 * Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnAddressFlags(int lineNumber) {
		if (IntermediateFile.brArray.get(lineNumber) == 1) {
			if (IntermediateFile.indirectAddress.get(lineNumber) == 1) { 
				return "011"; 	//BASE INDIRECT
			} else if (IntermediateFile.relativeAddress.get(lineNumber) == 1){
				return "001"; 	//BASE RELATIVE
			} else {
				return "100";	//DIRECT
			}
		} else {
			if (IntermediateFile.directAddress.get(lineNumber) == 1) { 	
				return "100"; //DIRECT
			} else {
				if (IntermediateFile.indirectAddress.get(lineNumber) == 1) { 
					return "010"; 	//START INDIRECT
				} else {
					return "000"; 	//START RELATIVE
				}
			}
		}
	}

	/**
	 * @modulename returnSourceCodeLine
	 * @description Returns the Line of Original Source Code for the line of 
	 * code with the given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Line of Source Code will be returned.
	 * 
	 * @outparam A String that is the Line of Source Code for the Current Line 
	 * of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnSourceCodeLine(int lineNumber) {
		return sourceCodeArray.get(lineNumber);
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static String returnLiteral(int lineNumber) {
		int index = literalLineNumbersArray.indexOf(lineNumber);
		return literalArray.get(index);
	}

	/**
	 * @modulename returnIRBit
	 * @description Returns the IR Bit for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * IR Bit will be returned.
	 * 
	 * @outparam A String that is the IR Bit for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnIRBit(int lineNumber) {
		return irArray.get(lineNumber).toString();
	}

	/**
	 * @modulename returnARBit
	 * @description Returns the AR Bit for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * AR Bit will be returned.
	 * 
	 * @outparam A String that is the AR Bit for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnARBit(int lineNumber) {
		return arArray.get(lineNumber).toString();
	}

	/**
	 * @modulename returnBRBit
	 * @description Returns the BR Bit for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * BR Bit will be returned.
	 * 
	 * @outparam A String that is the BR Bit for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnBRBit(int lineNumber) {
		return brArray.get(lineNumber).toString();
	}

	/**
	 * @modulename returnDebugBit
	 * @description Returns the Debug Bit for the line of code with the 
	 * given line number.
	 * @callsequence
	 * 
	 * @inparam lineNumber - An Integer that represents the line of code whose
	 * Debug Bit will be returned.
	 * 
	 * @outparam A String that is the Debug Bit for the Current Line of Code.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String returnDebugBit(int lineNumber) {
		return debugArray.get(lineNumber).toString();
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static String[] returnLiterals() {
		String[] litArray = literalArray.toArray(new String[0]);
		return litArray;
	}
	
	public static String[] returnLiterals(int lineNumber) {
		String[] litArray = literalArray.toArray(new String[0]);
		return litArray;
	}

	/**
	 * @modulename size
	 * @description Returns the number of lines of code that were processed and
	 * that are contained in the representation
	 * @callsequence
	 * 
	 * @inparam none
	 * 
	 * @outparam An Integer that is the number of lines of code contained in 
	 * this representation.
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 11/3/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static Integer size() {
		return IntermediateFile.size;
	}

	/**
	 * @modulename finishLine
	 * @description Preforms some finishing formatting operations to the current 
	 * line of Source Code. This method is required to be called before the new
	 * line method, and before the createFullIntermediateFile method. REQUIRED.
	 * 
	 * @callsequence 
	 * 
	 * @inparam none
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void finishLine() {
		if (!IntermediateFile.lineInfo.contains("IRSet")) {
			IntermediateFile.irArray.add(0);
			IntermediateFile.lineInfo.add("IRSet");
		}
		if (!IntermediateFile.lineInfo.contains("BRSet")) {
			IntermediateFile.brArray.add(0);
			IntermediateFile.lineInfo.add("BRSet");
		}
		if (!IntermediateFile.lineInfo.contains("ARSet")) {
			IntermediateFile.arArray.add(0);
			IntermediateFile.lineInfo.add("ARSet");
		}
		if (!IntermediateFile.lineInfo.contains("DebugSet")) {
			IntermediateFile.debugArray.add(0);
			IntermediateFile.lineInfo.add("DebugSet");
		} 
		if (!IntermediateFile.lineInfo.contains("DirectAddSet")) {
			IntermediateFile.directAddress.add(0);
			IntermediateFile.lineInfo.add("DirectAddSet");
		}
		if (!IntermediateFile.lineInfo.contains("fullOpSet")) {
			IntermediateFile.fullOperandArray.add("n/a");
			IntermediateFile.lineInfo.add("fullOpSet");
		}
		if (!IntermediateFile.lineInfo.contains("RelativeAddSet")) {
			IntermediateFile.relativeAddress.add(0);
			IntermediateFile.lineInfo.add("RelativeAddSet");
		}
		if (!IntermediateFile.lineInfo.contains("IndirectAddSet")) {
			IntermediateFile.indirectAddress.add(0);
			IntermediateFile.lineInfo.add("IndirectAddSet");
		}
		if (!IntermediateFile.lineInfo.contains("opSet")) {
			IntermediateFile.operationArray.add("ERROR");
			IntermediateFile.lineInfo.add("opSet");
		}
		if (!IntermediateFile.lineInfo.contains("lcSet")) {
			IntermediateFile.locationCounterArray.add(IntermediateFile.previousLC);
			IntermediateFile.lineInfo.add("opSet");
		}
		if (!IntermediateFile.lineInfo.contains("labelSet")) {
			IntermediateFile.labelArray.add("n/a");
			IntermediateFile.lineInfo.add("labelSet");
		}
		if (!IntermediateFile.lineInfo.contains("binOpSet")) {
			IntermediateFile.binaryOperationArray.add("n/a");
			IntermediateFile.lineInfo.add("binOpSet");
		}
		if (!IntermediateFile.lineInfo.contains("operandSet")) {
			IntermediateFile.tempOperandsArray.clear();
			IntermediateFile.tempOperandsArray.add("n/a");
			IntermediateFile.lineInfo.add("operandSet");
		}
		if (!IntermediateFile.lineInfo.contains("relCodeSet")) {
			IntermediateFile.relocationCodeArray.add("n/a");
			IntermediateFile.lineInfo.add("relCodeSet");
		}
		IntermediateFile.operandsArray.add(IntermediateFile.tempOperandsArray);
		IntermediateFile.allLinesInfo.add(IntermediateFile.lineInfo);
		IntermediateFile.size++;
		//IntermediateFile.finishedLines.add(IntermediateFile.createLine());
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void finishLine(int lineNumber) {
		if (!IntermediateFile.lineInfo.contains("IRSet")) {
			if (lineNumber >= irArray.size()) {
				IntermediateFile.irArray.add(0);
			} else {
				IntermediateFile.irArray.set(lineNumber, 0);
			}
			IntermediateFile.lineInfo.add("IRSet");
		}
		if (!IntermediateFile.lineInfo.contains("BRSet")) {
			if (lineNumber >= brArray.size()) {
				IntermediateFile.brArray.add(0);
			} else {
				IntermediateFile.brArray.set(lineNumber, 0);
			}
			IntermediateFile.lineInfo.add("BRSet");
		}
		if (!IntermediateFile.lineInfo.contains("ARSet")) {
			if (lineNumber >= arArray.size()) {
				IntermediateFile.arArray.add(0);
			} else {
				IntermediateFile.arArray.set(lineNumber, 0);
			}
			IntermediateFile.lineInfo.add("ARSet");
		}
		if (!IntermediateFile.lineInfo.contains("DebugSet")) {
			if (lineNumber >= debugArray.size()) {
				IntermediateFile.debugArray.add(0);
			} else {
				IntermediateFile.debugArray.set(lineNumber, 0);
			}
			IntermediateFile.lineInfo.add("DebugSet");
		} 
		if (!IntermediateFile.lineInfo.contains("DirectAddSet")) {
			if (lineNumber >= directAddress.size()) {
				IntermediateFile.directAddress.add(0);
			} else {
				IntermediateFile.directAddress.set(lineNumber, 0);
			}
			IntermediateFile.lineInfo.add("DirectAddSet");
		}
		if (!IntermediateFile.lineInfo.contains("fullOpSet")) {
			if (lineNumber >= fullOperandArray.size()) {
				IntermediateFile.fullOperandArray.add("n/a");
			} else {
				IntermediateFile.fullOperandArray.set(lineNumber, "n/a");
			}
			IntermediateFile.lineInfo.add("fullOpSet");
		}
		if (!IntermediateFile.lineInfo.contains("RelativeAddSet")) {
			if (lineNumber >= relativeAddress.size()) {
				IntermediateFile.relativeAddress.add(0);
			} else {
				IntermediateFile.relativeAddress.set(lineNumber, 0);
			}
			IntermediateFile.lineInfo.add("RelativeAddSet");
		}
		if (!IntermediateFile.lineInfo.contains("IndirectAddSet")) {
			if (lineNumber >= indirectAddress.size()) {
				IntermediateFile.indirectAddress.add(0);
			} else {
				IntermediateFile.indirectAddress.set(lineNumber, 0);
			}
			IntermediateFile.lineInfo.add("IndirectAddSet");
		}
		if (!IntermediateFile.lineInfo.contains("opSet")) {
			if (lineNumber >= operationArray.size()) {
				IntermediateFile.operationArray.add("ERROR");
			} else {
				IntermediateFile.operationArray.set(lineNumber, "ERROR");
			}
			IntermediateFile.lineInfo.add("opSet");
		}
		if (!IntermediateFile.lineInfo.contains("lcSet")) {
			if (lineNumber >= locationCounterArray.size()) {
				IntermediateFile.locationCounterArray.add(IntermediateFile.previousLC);
			} else {
				IntermediateFile.locationCounterArray.set(lineNumber, IntermediateFile.previousLC);
			}
			IntermediateFile.lineInfo.add("opSet");
		}
		if (!IntermediateFile.lineInfo.contains("labelSet")) {
			if (lineNumber >= labelArray.size()) {
				IntermediateFile.labelArray.add("n/a");
			} else {
				IntermediateFile.labelArray.set(lineNumber, "n/a");
			}
			IntermediateFile.lineInfo.add("labelSet");
		}
		if (!IntermediateFile.lineInfo.contains("binOpSet")) {
			if (lineNumber >= binaryOperationArray.size()) {
				IntermediateFile.binaryOperationArray.add("n/a");
			} else {
				IntermediateFile.binaryOperationArray.set(lineNumber, "n/a");
			}
			IntermediateFile.lineInfo.add("binOpSet");
		}
		if (!IntermediateFile.lineInfo.contains("operandSet")) {
			IntermediateFile.tempOperandsArray.clear();
			IntermediateFile.tempOperandsArray.add("n/a");
			IntermediateFile.lineInfo.add("operandSet");
		}
		if (!IntermediateFile.lineInfo.contains("relCodeSet")) {
			if (lineNumber >= relocationCodeArray.size()) {
				IntermediateFile.relocationCodeArray.add("n/a");
			} else {
				IntermediateFile.relocationCodeArray.set(lineNumber, "n/a");
			}
			IntermediateFile.lineInfo.add("relCodeSet");
		}
		if (lineNumber >= operandsArray.size()) {
			IntermediateFile.operandsArray.add(IntermediateFile.tempOperandsArray);
		} else {
			IntermediateFile.operandsArray.set(lineNumber, IntermediateFile.tempOperandsArray);
		}
		if (lineNumber >= allLinesInfo.size()) {
			IntermediateFile.allLinesInfo.add(IntermediateFile.lineInfo);
		} else {
			IntermediateFile.allLinesInfo.set(lineNumber, IntermediateFile.lineInfo);
		}
		IntermediateFile.size++;
		//IntermediateFile.finishedLines.set(lineNumber, IntermediateFile.createLine());
	}

	/**
	 * @modulename newLine
	 * @description Before each new line of code is added to the Intermediate File, 
	 * this method is required to be called to prepare the IntermediateFile Object. This 
	 * method is required to be called before calling any other methods in the 
	 * Intermediate File  REQUIRED.
	 * 
	 * @callsequence 
	 * 
	 * @inparam lineOfSourceCode a String that represents the original line of
	 * Source Code to be output along with the Intermediate File.
	 * @outparam none
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void newLine(String lineOfSourceCode) {
		IntermediateFile.tempOperandsArray.clear();
		IntermediateFile.sourceCodeArray.add(lineOfSourceCode);
		IntermediateFile.lineInfo.clear();
		IntermediateFile.isEmptyLine = Boolean.FALSE;
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void newLine(int lineNumber, String lineOfSourceCode) {
		IntermediateFile.tempOperandsArray.clear();
		if (lineNumber >= sourceCodeArray.size()) {
			IntermediateFile.sourceCodeArray.add(lineOfSourceCode);
		} else {
			IntermediateFile.sourceCodeArray.add(lineNumber, lineOfSourceCode);
		}
		IntermediateFile.lineInfo.clear();
		IntermediateFile.isEmptyLine = Boolean.FALSE;
	}

	/**
	 * @modulename output
	 * @description Outputs the Full Intermediate File and Symbol Table. Each
	 * line will contain all the information added to the IntermediateFile Object, and
	 * the information given in the Symbol Table as a parameter.
	 * @callsequence 
	 * 
	 * @inparam symbolTable A String that represents the Completed Symbol Table
	 * @outparam
	 * @errorstested 
	 * @errorsgenerated 

	 * @createdate 10/14/09
	 * @modlog <p>
	 *         <ul>
	 *         Who/When/Why
	 *         <li>
	 *         </ul>
	 *         Coding Standards Met: "Signed Code Leader(Jaron)"
	 *         <p>
	 *         Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String output(String symbolTable) {
		StringBuilder outputText = new StringBuilder("\t...INTERMEDIATE FILE...");
		outputText.append(newline);
		int n = 0;
		while (n < IntermediateFile.size()) {
			outputText.append(FileFormatter.formatIntermediateFile());
			outputText.append(newline);
			n++;
		}
		outputText.append(newline);
		outputText.append("\t...UNSORTED SYMBOL TABLE...");
		outputText.append(newline);
		outputText.append(symbolTable);
		return outputText.toString();
	}
}
